package com.example.inboxdemo.pojo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author haoxr
 * @date 2020-06-23
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Result<T> implements Serializable {

    private String code;

    private T data;

    private String msg;

    public static Result success() {
        Result result = new Result();
        result.code = "00000";
        result.msg = "success";
        return result;
    }

    public static <T> Result<T> success(T t) {
        Result<T> result = new Result<>();
        result.code = "00000";
        result.msg = "success";
        result.data = t;
        return result;
    }

}
